<template>
<div>{{name}}</div>
</template>

<script>
    export default {
      data(){
        return{
          name:''
        }
      },
        name: "axios.vue",
     beforeRouteEnter:(to,from,next)=>{

          next(vm=>{
            vm.getData();
          });
     },
      methods:{
          getData: function(){
              this.axios({
                method:'get',
                url:'http://localhost:8080/static/mock/data.json'
              }).then(function(response){
                this.name=response.name;
              })
          }
      }
    }
</script>

<style scoped>

</style>
